package com.pingbu.tijian.hospital.backapi.api;

import com.github.pagehelper.PageInfo;
import com.pingbu.common.bean.ResultBean;
import com.pingbu.tijian.hospital.backapi.bean.entity.Teacher;
import com.pingbu.tijian.hospital.backapi.bean.entity.VideoUpload;
import com.pingbu.tijian.hospital.backapi.service.TeacherService;
import com.pingbu.tijian.hospital.backapi.service.VideoUploadService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.xml.transform.Result;
import java.io.IOException;
import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/teacher")
public class TeacherController {

    private static Logger logger = LoggerFactory.getLogger(TeacherController.class);

    @Autowired
    private TeacherService teacherService;



    @RequestMapping("/save")
    public ResultBean<Integer> save(@RequestBody Teacher teacher){
        ResultBean<Integer> rb1 = null;
        if ("".equals(teacher.getNoid()) || teacher.getNoid() == null){
            rb1 = teacherService.insert(teacher);
        }else {
            rb1 = teacherService.edit(teacher);
        }
        return rb1;
    }

    @RequestMapping("/delete")
    public ResultBean<Integer> delete(@RequestBody Teacher teacher){
        ResultBean<Integer> rb1 = teacherService.delete(teacher);
        return rb1;
    }

}
